/* GMFSController.h -- 
   Copyright (C) 2007 Casey Marshall <casey.s.marshall@gmail.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  */


#import <Cocoa/Cocoa.h>

@interface GMFSController : NSObject
{
  IBOutlet NSWindow *mainWindow;
  IBOutlet NSTableView *accountsTable;
  IBOutlet NSButton *addButton;
  IBOutlet NSButton *delButton;
  IBOutlet NSTextField *usernameField;
  IBOutlet NSSecureTextField *passwordField;
  IBOutlet NSButton *proxyEnabled;
  IBOutlet NSTextField *proxyField;
  IBOutlet NSButton *autoMount;
  IBOutlet NSMenu *disksMenu;
  IBOutlet NSMenu *dockMenu;
  
  // Password dialog
  IBOutlet NSPanel *passwordDialog;
  IBOutlet NSTextField *passwordDialogLabel;
  IBOutlet NSSecureTextField *passwordDialogField;
  IBOutlet NSButton *passwordDialogSavePassword;
  IBOutlet NSButton *passwordDialogCancel;
  IBOutlet NSButton *passwordDialogConnect;
  
  // Mount tracking.
  NSMutableDictionary *filesystems;
}

- (IBAction) showAccounts: (id) sender;
- (void) tableSelectionChanged: (NSNotification *) aNotification;
- (void) fstaskExited: (NSNotification *) aNotification;

// Actions that update user preferences.

- (IBAction) addAccount: (id) sender;
- (IBAction) delAccount: (id) sender;
- (IBAction) setUsername: (id) sender;
- (IBAction) toggleUseProxy: (id) sender;
- (IBAction) setProxy: (id) sender;
- (IBAction) toggleAutoMount: (id) sender;

// Actions that access the user's keychain.

- (IBAction) setPassword: (id) sender;

// Mount and unmount

- (void) mount: (NSDictionary *) accountInfo;
- (void) unmount: (NSString *) accountName;
- (IBAction) mountFromMainMenu: (id) sender;
- (IBAction) mountFromDockMenu: (id) sender;

// Password dialog

- (IBAction) passwordDialogCancel: (id) sender;
- (IBAction) passwordDialogConnect: (id) sender;

// NSTableDataSource

- (int) numberOfRowsInTableView: (NSTableView *) view;
- (id) tableView: (NSTableView *) aTableView
 objectValueForTableColumn: (NSTableColumn *) aTableColumn
             row: (int) rowIndex;
- (void) tableView: (NSTableView *) aTableView
    setObjectValue: (id) anObject
    forTableColumn: (NSTableColumn *) aTableColumn
               row: (int) rowIndex;

- (BOOL) nameIsOkay: (NSString *) name
           accounts: (NSArray *) array;

@end
